home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / pmake / lst / lstCur.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-05-19  |  1.5 KB  |  55 lines

  1. /*-
  2.  * LstCur.c --
  3.  *    Return the current node in the list.
  4.  *    The sequential functions access the list in a slightly different way.
  5.  *    CurPtr points to their idea of the current node in the list and they
  6.  *    access the list based on it. Because the list is circular, Lst_Next
  7.  *    and Lst_Prev will go around the list forever. Lst_IsAtEnd must be
  8.  *    used to determine when to stop.
  9.  *
  10.  * Copyright (c) 1988 by University of California Regents
  11.  *
  12.  * Permission to use, copy, modify, and distribute this
  13.  * software and its documentation for any purpose and without
  14.  * fee is hereby granted, provided that the above copyright
  15.  * notice appears in all copies.  Neither the University of California nor
  16.  * Adam de Boor makes any representations about the suitability of this
  17.  * software for any purpose.  It is provided "as is" without
  18.  * express or implied warranty.
  19.  */
  20. #ifndef lint
  21. static char *rcsid =
  22. "$Id: lstCur.c,v 1.4 88/11/17 20:52:03 adam Exp $ SPRITE (Berkeley)";
  23. #endif lint
  24.  
  25. #include    "lstInt.h"
  26.  
  27. /*-
  28.  *-----------------------------------------------------------------------
  29.  * Lst_Cur --
  30.  *    Return the current node if the list is open for sequential
  31.  *    access.
  32.  *
  33.  * Results:
  34.  *    The current node or NILLNODE if the list isn't open..
  35.  *
  36.  * Side Effects:
  37.  *    None.
  38.  *
  39.  *-----------------------------------------------------------------------
  40.  */
  41. LstNode
  42. Lst_Cur (l)
  43.     Lst        l;
  44. {
  45.     register List list = (List)l;
  46.  
  47.     if ((LstValid(l) == FALSE) ||
  48.     (list->isOpen == FALSE)) {
  49.         return (NILLNODE);
  50.     } else {
  51.     return ((LstNode)list->curPtr);
  52.     }
  53. }
  54.  
  55.